//  Project name: StrikingCars
//  File name   : AppConfig.h
//
//  Author      : Phuc, Tran Huu
//  Created date: 11/22/12
//  Version     : 1.00
//  --------------------------------------------------------------
//  Copyright (C) 2012 Phuc, Tran Huu. All Rights Reserved.
//  --------------------------------------------------------------

#define kAppDelegate                    (AppDelegate   *) [[UIApplication sharedApplication] delegate]
#define kDirector                       (CCDirectorIOS *) [CCDirector sharedDirector]

#define kAppViewController              [kAppDelegate appViewController]
#define kSize                           [kDirector winSize]

#define kScrollDuration                 0.5f

/**
 * Pixel to metres ratio. Box2D uses metres as the unit for measurement. This ratio defines how many
 * pixels correspond to 1 Box2D "metre". Box2D is optimized for objects of 1x1  metre  therefore  it
 * makes sense to define the ratio so that your most common object type is 1x1 metre.
 */
#define PTM_RATIO                       32

#define DEG_TO_RAD                      0.0174532925199432957f
#define RAD_TO_DEG                      57.295779513082320876f


CG_INLINE CGPoint revealPointInsideSprite(CCSprite *sprite, CGPoint currentPosition, CGPoint point) {
    CGPoint revealPoint = ccpAdd(currentPosition, point);
    revealPoint.y = currentPosition.y;
    revealPoint.x = MIN(revealPoint.x, 0.0f);
    revealPoint.x = MAX(revealPoint.x, -sprite.contentSize.width + kSize.width);
    
    return revealPoint;
}